<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/css/bootstrap.min.css}"/>
    <script src="/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
    <script src="/js/jquery-3.4.1.min.js" th:src="@{/js/jquery-3.4.1.min.js}"></script>
    <script src="/js/main.js" th:src="@{/js/main.js}"></script>
    <script src="/js/bootstrap.bundle.js" th:src="@{/js/bootstrap.bundle.js}"></script>
    <script src="/js/bootstrap.bundle.min.js" th:src="@{/js/bootstrap.bundle.min.js}"></script>
    <script src="/js/bootstrap.js" th:src="@{/js/bootstrap.js}"></script>
    <script src="/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
    <link href="/css/font-awesome.css" th:href="@{/css/font-awesome.css}" rel="stylesheet">
    <link href="/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet">
    <link href="/css/bootstrap-grid.css" th:href="@{/css/bootstrap-grid.css}" rel="stylesheet">
    <link href="/css/bootstrap-grid.min.css" th:href="@{/css/bootstrap-grid.min.css}" rel="stylesheet">
    <link href="/css/bootstrap-reboot.css" th:href="@{/css/bootstrap-reboot.css}" rel="stylesheet">
    <link href="/css/bootstrap-reboot.min.css" th:href="@{/css/bootstrap-reboot.min.css}" rel="stylesheet">
    <link href="/css/bootstrap.css" th:href="@{/css/bootstrap.css}" rel="stylesheet">
    <link href="/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body style="background: #effae7">
<div>
    <table class="navbar navbar-expand-sm bg-dark navbar-dark" style="background-color:#343a40">
        <tr></tr>
        <tr class="navbar-nav">
            <td class="nav-item active display-4 text-white">
                新闻后台管理系统
            </td>
        </tr>
    </table>
</div>


<br/>
<!--第一部分投票-->
<div style="padding: 0 200px;">
    <h1>标题：</h1>
    <h1 th:text="${title}"></h1>
    <h2>内容：</h2>
    <h2 th:text="${message}"></h2>
    <!--    <h2 style="text-align:left; margin-bottom: 20px">投票管理</h2>-->
    <table border="1" class="table table-striped table-bordered table-hover"
           style="border-radius: 10px;font-size: 14px">
        <thead class="thead-dark">
        <tr>
            <td>序号</td>
            <td>评论</td>
            <td>日期</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <tr th:each="comments : ${comment}" class="table-active">
            <td th:text="${comments.cid}"></td>
            <td th:text="${comments.message}"></td>
            <td th:text="${comments.date}"></td>
            <td>
                <div>
                    <a onclick="deleteImg(this)" th:id="${comments.cid}" style="text-align:center;"><i
                            class="btn btn-danger">删除</i></a>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
</div>


</body>

</html>
<script>
    function deleteImg(obj) {
        console.log(obj.id)
        $.ajax({
            url: "/manager/comment/delete/" + obj.id,
            type: 'delete',
            success: function (result) {
                console.log("删除成功!");
                location.reload();
            },
            error: function () {
                console.log("删除失败!");
                location.reload();
            }

        });
    }
</script>